package io.xccit.type;

import java.util.*;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2024/4/8
 * <p>福利彩票</p>
 */
public class Welfare {
    /**
     * 双色球
     *
     * @return
     */
    public void getUnionLotto() {
        int[] red = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33};
        int[] blue = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
        Set<Integer> luckyResult = new HashSet<>();
        Random random = new Random();
        while (luckyResult.size() < 6) {
            int luckyRed = random.nextInt(red.length);
            luckyResult.add(red[luckyRed]);
        }
        int luckyBlue = random.nextInt(blue.length);
        Iterator<Integer> iterator = luckyResult.iterator();
        System.out.print("Red:" + " ");
        while (iterator.hasNext()) {
            System.out.print(iterator.next() + " ");
        }
        System.out.print("Blue: " + blue[luckyBlue]);
        System.out.println();
    }

    /**
     * 快乐8
     */
    public void happyEight() {
        Random luckyRandom = new Random();
        Set<Integer> luckyResult1 = new HashSet<>();
        Set<Integer> luckyResult2 = new HashSet<>();
        Set<Integer> luckyResult3 = new HashSet<>();
        Set<Integer> luckyResult4 = new HashSet<>();
        Set<Integer> luckyResult5 = new HashSet<>();
        Set<Integer> luckyResult6 = new HashSet<>();
        Set<Integer> luckyResult7 = new HashSet<>();
        Set<Integer> luckyResult8 = new HashSet<>();
        Set<Integer> luckyResult9 = new HashSet<>();
        Set<Integer> luckyResult10 = new HashSet<>();
        System.out.println("Select 1-10,Good luck for u,Result:");
        int luckyMin = 1;
        int luckyMax = 80;
        int luckyOne = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
        luckyResult1.add(luckyOne);
        while (luckyResult2.size() < 2) {
            int luckyTwo = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult2.add(luckyTwo);
        }
        while (luckyResult3.size() < 3) {
            int luckyThree = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult3.add(luckyThree);
        }
        while (luckyResult4.size() < 4) {
            int luckyFour = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult4.add(luckyFour);
        }
        while (luckyResult5.size() < 5) {
            int luckyFive = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult5.add(luckyFive);
        }
        while (luckyResult6.size() < 6) {
            int luckySix = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult6.add(luckySix);
        }
        while (luckyResult7.size() < 7) {
            int luckySeven = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult7.add(luckySeven);
        }
        while (luckyResult8.size() < 8) {
            int luckyEight = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult8.add(luckyEight);
        }
        while (luckyResult9.size() < 9) {
            int luckyNine = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult9.add(luckyNine);
        }
        while (luckyResult10.size() < 10) {
            int luckyTen = luckyMin + luckyRandom.nextInt(luckyMax - luckyMin + 1);
            luckyResult10.add(luckyTen);
        }
        System.out.println("select1:" + luckyResult1.toString());
        System.out.println("select2:" + luckyResult2.toString());
        System.out.println("select3:" + luckyResult3.toString());
        System.out.println("select4:" + luckyResult4.toString());
        System.out.println("select5:" + luckyResult5.toString());
        System.out.println("select6:" + luckyResult6.toString());
        System.out.println("select7:" + luckyResult7.toString());
        System.out.println("select8:" + luckyResult8.toString());
        System.out.println("select9:" + luckyResult9.toString());
        System.out.println("select10:" + luckyResult10.toString());
    }

    /**
     * 3D
     */
    public void luck3D() {
        List<Integer> luckyResult = new ArrayList<>();
        Random random = new Random();
        while (luckyResult.size() < 3) {
            int luckyNumber = random.nextInt(9);
            luckyResult.add(luckyNumber);
        }
        System.out.println("3D:" + luckyResult.toString());
    }

    /**
     * 七乐彩
     */
    public void sevenHappy(){
        int luckyMin = 1;
        int luckyMax = 30;
        Set<Integer> luckyResult = new HashSet<>();
        Random luckyRandom = new Random();
        int luckyNumber = luckyRandom.nextInt(luckyMin + luckyMax - luckyMin + 1);
        while (luckyResult.size() < 7){
            luckyResult.add(luckyNumber);
        }
        System.out.println("Seven Lucky Number:" + luckyResult.toString());
    }
}
